package com.google.code.jtasks.model;

import com.google.code.jtasks.adapters.ITaskSystemAdapter;
import com.google.code.jtasks.model.IMappedTask.TaskField;

/**
 * This unchecked {@link RuntimeException} should be thrown by {@link IMappedTask} implementations when users
 * request a task field that is not supported.
 * 
 * @see ITaskSystemAdapter#getUnsupportedTaskFields()
 */
public class UnsupportedTaskPropertyException extends RuntimeException
{
	private static final long serialVersionUID = -7854627071299221972L;

	/**
	 * Constructs a new {@link UnsupportedTaskPropertyException} instance.
	 * 
	 * @param adapterClass
	 *            the {@link Class} of the {@link ITaskSystemAdapter} that the task is from
	 * @param field
	 *            the unsupported {@link TaskField} that was accessed
	 */
	public UnsupportedTaskPropertyException(Class<? extends ITaskSystemAdapter<?, ?>> adapterClass,
			TaskField field)
	{
		super(String.format("The %s field was accessed for a task"
				+ " from the %s adapter, but this field is not supported by the adpater.", field.name(),
				adapterClass.getName()));
	}
}
